package de.mmis.core.base.informationprovider;

import java.util.Map;

import de.mmis.core.base.Position;
import de.mmis.core.base.Type;
import de.mmis.core.base.abstracttree.Tree;

/**
 * interface providing methods for receiving information of specific devices and
 * the controlling and representing components available
 * 
 * @author Christian Koch
 * 
 */
public interface DeviceInformationProvider {

	/**
	 * get device's type
	 * 
	 * @param id
	 *            ID of the device
	 * @return {@link Type} of the device class
	 */
	public abstract Type getDeviceType(String id);

	/**
	 * get all interfaces implemented by specified device class
	 * 
	 * @param deviceType
	 *            type of device
	 * @return all implementing interfaces
	 */
	public abstract Type[] getInterfaces(Type deviceType);

	/**
	 * get device's display names
	 * 
	 * @param id
	 *            ID of the device
	 * @return map (language code (ISO 639-3) -> value) of display names of the
	 *         device, or <code>null</code>, if it cannot be determined
	 */
	public abstract Map<String, String> getDisplayName(String id);

	/**
	 * get device's position
	 * 
	 * @param id
	 *            ID of the device
	 * @return map (location -> position) of the device, or <code>null</code>,
	 *         if it cannot be determined
	 */
	public abstract Map<String, Position> getPosition(String id);

	/**
	 * get device's property map containing all device information
	 * 
	 * @param id
	 *            ID of the device
	 * @return property map of the device, or <code>null</code>, if it cannot be
	 *         determined
	 */
	public abstract Map<String, Object> getPropertiesMap(String id);

	/**
	 * get a Tree for creating a local instance of this device
	 * 
	 * @param id
	 *            ID of the device
	 * @return a Tree that can be deserialized to a device object, or
	 *         <code>null</code>, if it cannot be determined
	 */
	public abstract Tree getLocalInstanceTree(String id);

	/**
	 * @return the class loader associated with this information provider. If an
	 *         information provider creates its own ClassLoader to retrieve
	 *         class data, it should be returned here.
	 */
	public abstract ClassLoader getInformationProviderClassLoader();

	/**
	 * @return all control components available
	 */
	public abstract Class<?>[] getControlComponentClasses();

	/**
	 * @return all representation components available
	 */
	public abstract Class<?>[] getRepresentationComponentClasses();
}